/**
 * 商品分类服务
 */
angular.module('category.service', [])
  .factory('categoryFty', function ($q) {
    return {
      getCategoryData: function () {
        var categoryData = [
          {
            name: "热销",
            typeNumber: '100'
          },
          {
            name: "经典必吃",
            typeNumber: '101'
          },
          {
            name: "优惠",
            typeNumber: '102'
          },
          {
            name: "老板推荐",
            typeNumber: '103'
          },
          {
            name: "单加",
            typeNumber: '104'
          },
          {
            name: "添油加醋",
            typeNumber: '105'
          },
          {
            name: "套餐",
            typeNumber: '106'
          },
          {
            name: "酒水饮料",
            typeNumber: '107'
          },
          {
            name: "炸鸡卤味",
            typeNumber: '108'
          },
          {
            name: "收藏福利",
            typeNumber: '109'
          }
          // {
          //   name: "沸腾火锅",
          //   typeNumber: '110'
          // },
          // {
          //   name: "日韩料理",
          //   typeNumber: '111'
          // },
          // {
          //   name: "滋补炖汤",
          //   typeNumber: '112'
          // },
          // {
          //   name: "轻食沙拉",
          //   typeNumber: '113'
          // },
          // {
          //   name: "水果鲜花",
          //   typeNumber: '114'
          // },
          // {
          //   name: "便捷超市",
          //   typeNumber: '115'
          // }
        ];
        // 假设数据请求成功
        var deferred = $q.defer();
        deferred.resolve(categoryData);
        return deferred.promise;
      },
      getCategoryDetailData: function (typeNumber) {
        var categoryDetailData = [];
        if (typeNumber == 100) {
          categoryDetailData = [
            {
              name: "霸王茶姬",
              src: "img/home/seckill_1.jpg",
              typeNumber: '10401',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            }, {
              name: "益和堂",
              src: "img/category/ms0.jpg",
              typeNumber: '10402',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "臻味肉蟹煲",
              src: "img/category/ms1.jpg",
              typeNumber: '10101',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "琼阁院瓦香鸡",
              src: "img/category/ms2.jpg",
              typeNumber: '10102',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "双椒兔",
              src: "img/category/ms3.jpg",
              typeNumber: '10103',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "虾来啦手打虾滑",
              src: "img/category/ms4.jpg",
              typeNumber: '10104',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "肥牛卷",
              src: "img/category/ms5.jpg",
              typeNumber: '10105',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "冒牌冒菜",
              src: "img/category/ms6.gif",
              typeNumber: '10106',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "128鲜味火锅",
              src: "img/category/ms7.jpg",
              typeNumber: '10107',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "江湖儿女",
              src: "img/category/ms8.jpg",
              typeNumber: '10108',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "塔斯汀中国汉堡",
              src: "img/category/ms9.jpg",
              typeNumber: '10201',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "茶百道",
              src: "img/category/ms10.jpg",
              typeNumber: '10403',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "豆吉汤圆奶茶",
              src: "img/category/ms11.jpg",
              typeNumber: '10404',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            }, {
              name: "占位图",
              src: "img/category/null.jpg",
              typeNumber: '10000',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            }
          ];
        } else if (typeNumber == 104) {
          categoryDetailData = [
            {
              name: "霸王茶姬",
              src: "img/home/seckill_1.jpg",
              typeNumber: '10401',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            }, {
              name: "益和堂",
              src: "img/category/ms0.jpg",
              typeNumber: '10402',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "茶百道",
              src: "img/category/ms10.jpg",
              typeNumber: '10403',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "豆吉汤圆奶茶",
              src: "img/category/ms11.jpg",
              typeNumber: '10404',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            }
          ];
        } else {
          categoryDetailData = [
            {
              name: "臻味肉蟹煲",
              src: "img/category/ms1.jpg",
              typeNumber: '10101',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "琼阁院瓦香鸡",
              src: "img/category/ms2.jpg",
              typeNumber: '10102',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "双椒兔",
              src: "img/category/ms3.jpg",
              typeNumber: '10103',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "虾来啦手打虾滑",
              src: "img/category/ms4.jpg",
              typeNumber: '10104',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "冒牌冒菜",
              src: "img/category/ms6.gif",
              typeNumber: '10106',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "128鲜味火锅",
              src: "img/category/ms7.jpg",
              typeNumber: '10107',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "江湖儿女",
              src: "img/category/ms8.jpg",
              typeNumber: '10108',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "塔斯汀中国汉堡",
              src: "img/category/ms9.jpg",
              typeNumber: '10201',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            },
            {
              name: "占位图",
              src: "img/category/null.jpg",
              typeNumber: '100011',
              score: "4.5",
              sell: "200+",
              per: "￥15",
              operation: "天天神券"
            }
          ];
        }
        // 假设数据请求成功
        var deferred = $q.defer();
        deferred.resolve(categoryDetailData);
        return deferred.promise;
      }
    }
  });
